/*
 * common.h本应为dnfs.h，但是考虑到开发期间dnfs.h会被dnfs.x覆盖，所以正式版本中要把common.h加入
 */
#ifndef _DNFS_H_
#define _DNFS_H_
typedef uint32_t CHUNKNUM;
typedef uint32_t CHUNKSIZE;
/*#define ICHUNK_SIZE (OIDLEN + IPLEN + sizeof(CHUNKSIZE))*/
#define ICHUNK_SIZE sizeof(CHUNK_MEM)
#define RTOW	0
#define WTOR 1
typedef struct chunk{
	OID oid;
	IP ip;
	uint32_t len;
/*	uint32_t pid;*/
} CHUNK;

typedef struct chunk_mem {
	char oid[OIDLEN];
	IP ip;
	CHUNKSIZE size;
} CHUNK_MEM;

struct META{
	struct DSTAT stbuf;
	uint32_t ossnum;
	CHUNK *chunkarray;
} META;

/*
 * Macros to help debugging
 */

#undef PDEBUG             /* undef it, just in case */
#ifdef DNFS_DEBUG
     /* This one for user space */
#    define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
#else
#  define PDEBUG(fmt, args...) /* not debugging: nothing */
#endif

#if __WORDSIZE == 32
	#define _FILE_OFFSET_BITS 64
#endif

#endif
